package edu.scu.trainingplatform.config;

import java.io.File;
import javax.servlet.MultipartConfigElement;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringConfig {

  @Bean
  MultipartConfigElement multipartConfigElement() {
    MultipartConfigFactory factory = new MultipartConfigFactory();
    ApplicationHome home = new ApplicationHome(getClass());
    factory.setLocation(home.getDir() + File.separator + "tmp");
    return factory.createMultipartConfig();
  }
}
